package com.download.web.entity.model;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.List;

/**
 * @description: 分页类
 * @author: cmy
 * @create: 2019-02-21 10:43
 **/
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class Page<T> {

    private List<T> list;
    private Integer totalPage;
    private Integer totalSize;
    private Integer pageIndex;
    private Integer pageSize;

    public Page(List<T> list, Integer totalSize, Integer pageIndex, Integer pageSize) {
        this.list = list;
        this.totalSize = totalSize;
        this.pageIndex = pageIndex;
        this.pageSize = pageSize;
        this.totalPage=totalSize/pageSize%2==0?totalSize/pageSize:totalSize/pageSize+1;
    }
}
